﻿using System.Collections.Generic;

public class ChessMa : BaseChess
{
    private List<(Pos, List<Pos>)> judgePoints = new List<(Pos, List<Pos>)>()
    {
        (new Pos(0,-1),new List<Pos>(){new Pos(-1,-2),new Pos(1,-2) }),
        (new Pos(0,1),new List<Pos>(){new Pos(-1,2),new Pos(1,2) }),
        (new Pos(-1,0),new List<Pos>(){new Pos(-2,-1),new Pos(-2,1) }),
        (new Pos(1,0),new List<Pos>(){new Pos(2,-1),new Pos(2,1) })
    };
    public ChessMa(int camp, int team) : base(camp, team)
    {

    }
    public override void AddSomePosIntoList(BaseChessBoard chessBoard, List<Pos> tempPosList)
    {
        BaseGrid grid = chessBoard.GetGridByChess(this);
        if (grid != null)
        {
            Pos chessPos = grid.GetPos();
            Pos endPos;
            for (int i = 0; i < judgePoints.Count; i++)
            {
                Pos blockPos = chessPos.AddResult(judgePoints[i].Item1);
                if (chessBoard.SpaceIsGridAndNotExistChess(blockPos))
                {
                    for (int j = 0; j < judgePoints[i].Item2.Count; j++)
                    {
                        endPos = chessPos.AddResult(judgePoints[i].Item2[j]);
                        if (chessBoard.SpaceIsGridAndNotExistChess(endPos) || chessBoard.SpaceIsGridAndExistOtherTeamChess(endPos, GetTeam()))
                        {
                            tempPosList.Add(endPos);
                        }
                    }
                }
            }
        }
    }
    public override Score GetScore(BaseChessBoard baseChessBoard)
    {
        return new Score(8, 0);
    }
}